package com.lpf.chain;

// 客户端代码
public class ChainOfResponsibilityPatternDemo {
    public static void main(String[] args) {
        // 创建处理器链
        Handler technicalHandler = new TechnicalSupportHandler();
        Handler billingHandler = new BillingSupportHandler();
        Handler generalHandler = new GeneralSupportHandler();

        technicalHandler.setNextHandler(billingHandler);
        billingHandler.setNextHandler(generalHandler);

        // 测试不同的请求
        String[] requests = {"technical issue", "billing problem", "general inquiry", "unknown issue"};
        for (String request : requests) {
            System.out.println("\nProcessing request: " + request);
            technicalHandler.handleRequest(request);
        }
    }
}